package battleship.model;
/**
 * 
 * @author Cameron McLeod
 * @version 1.0
 */
public class Shot {
	public int x,y;
	private Grid TargetGrid;
	public Shot(Grid TGrid){
		TargetGrid = TGrid;
	}
	/**
	 * 
	 * @param grid the target grid
	 * @param i the x coordinate 
	 * @param j the y coordinate
	 */
	public Shot(Grid grid, int i, int j) {
		TargetGrid = grid;
		x = i;
		y = j;
	}
	/**
	 * 
	 * @param X the x coordinate on the grid
	 * @param Y the y coordinate on the grid
	 * @return if the shot was a hit
	 */
	public boolean hit(int X, int Y){
		x = X;
		y = Y;
		return TargetGrid.CheckOccupied(this);
	}
	/**
	 * 
	 * @return if the shot was a hit
	 */
	public boolean hit(){
		return TargetGrid.CheckOccupied(this);
	}

	
}
